package com.sixth.statistics.controller;

import com.sixth.core.entity.DictData;
import com.sixth.core.vo.R;
import com.sixth.statistics.service.DictDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author     ：Stu YH
 * @date       ：Created in 2024/8/14 16:24
 * @description：字典数据控制器
 * @modified By：
 * @version:
 */
@Api(tags = "查字典数据")
@RestController
@RequestMapping("/statistics/dict/data")
public class DictDataController {

    @Autowired
    private DictDataService dictDataService;

    @ApiOperation(value = "根据字典类型获取数据", notes = "根据传入的字典类型获取对应的字典数据列表")
    @GetMapping("type/{type}")
    public R<List<DictData>> listByType(@PathVariable String type) {
        return dictDataService.selectByType(type);
    }
}
